<template>
	<view class="content">
		<u-navbar :is-back="false" :background="background" :border-bottom="false" :is-fixed="false">
			<view class="slot-wrap" style="color: #333; font-size: 32rpx;width: 100vw;">
				<view class="slot-wrap" style="color: #fff; font-size: 32rpx;width: 100vw;margin-top: 40rpx;">
					<view class="tixian">
						<h3>账户余额</h3>
						<view class="p">
							{{user.cash?user.cash:0.00}}
						</view>
						<!-- #ifdef APP-PLUS -->
						<view class="btn" @click="openPage('pages/center/newWithdrawal', {user: JSON.stringify(user)})">
							去提现
						</view>
						<!-- #endif -->
					</view>
				</view>
			</view>
		</u-navbar>
		<view class="walletMain">
			<!-- <navigator url="walletInfo" class="mingxi">
				明细 <u-icon name="arrow-right"></u-icon>
			</navigator> -->
			<!-- <view class="tixian">
				<h3>可提现</h3>
				<view class="p">
					{{user.cash?user.cash:0.00}}
				</view>
				<view class="btn" @click="openPage('pages/center/newWithdrawal', {user: JSON.stringify(user)})">
					去提现
				</view>
			</view>
			<view class="walletMainList">
				<view class="li">
					<view class="num">
						{{user.total_cash?user.total_cash:0.00}}
					</view>
					<view class="h3">
						累计到账
					</view>

				</view>
				<view class="li">
					<view class="num">
						{{user.already_cash?user.already_cash:0.00}}
					</view>
					<view class="h3">
						已提现
					</view>
				</view>
			</view> -->
		</view>
		<view class="walletList con">
			<view class="walletT">
				<view class="l">
					今日日报
				</view>
				<navigator class="r" url="profitList">
					查看更多 <u-icon name="arrow-right"></u-icon>
				</navigator>
			</view>
			<view class="walletD">
				<view class="li">
					<view class="h3">
						预估收益
					</view>
					<view class="p">
						{{user.income_statistics.day_income.estimate_income?user.income_statistics.day_income.estimate_income:0}}
					</view>
				</view>
				<view class="li">
					<view class="h3">
						预估积分
					</view>
					<view class="p">
						{{user.income_statistics.day_income.estimate_integral?user.income_statistics.day_income.estimate_integral:0}}
					</view>
				</view>
				<view class="li">
					<view class="h3">
						预估活动奖励
					</view>
					<view class="p">
						{{user.income_statistics.day_income.estimate_activity_income?user.income_statistics.day_income.estimate_activity_income:0}}
					</view>
				</view>
				<view class="li">

				</view>
				<view class="li">
					<view class="h3">
						总粉丝新增
					</view>
					<view class="p">
						{{user.income_statistics.day_income.user_number?user.income_statistics.day_income.user_number:0}}
					</view>
				</view>
				<view class="li">
					<view class="h3">
						激活粉丝新增
					</view>
					<view class="p">
						{{user.income_statistics.day_income.activate_user_number?user.income_statistics.day_income.activate_user_number:0}}
					</view>
				</view>
			</view>

		</view>
		<view class="hr">

		</view>
		<view class="walletList con">
			<view class="walletT">
				<view class="l">
					本月月报
				</view>

				<navigator class="r" url="profitList">
					历史月报 <u-icon name="arrow-right"></u-icon>
				</navigator>
			</view>
			<view class="walletD">
				<view class="li">
					<view class="h3">
						预估收益
					</view>
					<view class="p">
						{{user.income_statistics.month_income.estimate_income?user.income_statistics.month_income.estimate_income:0}}
					</view>
				</view>
				<view class="li">
					<view class="h3">
						预估积分
					</view>
					<view class="p">
						{{user.income_statistics.month_income.estimate_integral?user.income_statistics.month_income.estimate_integral:0}}
					</view>
				</view>
				<view class="li">
					<view class="h3">
						预估活动奖励
					</view>
					<view class="p">
						{{user.income_statistics.month_income.estimate_activity_income?user.income_statistics.month_income.estimate_activity_income:0}}
					</view>
				</view>
				<view class="li">

				</view>
				<view class="li">
					<view class="h3">
						总粉丝新增
					</view>
					<view class="p">
						{{user.income_statistics.month_income.user_number?user.income_statistics.month_income.user_number:0}}
					</view>
				</view>
				<view class="li">
					<view class="h3">
						激活粉丝新增
					</view>
					<view class="p">
						{{user.income_statistics.month_income.activate_user_number?user.income_statistics.month_income.activate_user_number:0}}
					</view>
				</view>
			</view>

		</view>

	</view>
</template>

<script>
	import imagesUrl from '../../common/images.js'
	export default {
		data() {
			return {
				user: null,
				background: {
					background: "url(https://img.koalalf.com/gewuyunshang/bluebg.png) no-repeat",
					backgroundSize: "100%",
					width: '100vw',
					height: '492rpx'
				},
			}
		},
		onLoad() {
			
			this.images = imagesUrl.my
			let that = this;
			this.$u.api.userInfoByToken({}).then(res => {
				that.user = res
				uni.setStorageSync('user_info', JSON.stringify(res))
			})
			uni.$on('updateUserInfo', function(data) {
				this.$u.api.userInfoByToken({}).then(res => {
					that.user = res
					uni.setStorageSync('user_info', JSON.stringify(res))
				})
			})
			// that.getData()
		},
		methods: {
			getData(){
					this.$u.api.incomeDayList({page:1,pageSize:10}).then(res=>{
							console.log(res)
					})
			},
			openPage(path, params = {}) {
				if (path == 'customer') {
					uni.openCustomerServiceChat({
						extInfo: {
							url: ''
						},
						corpId: '',
						success(res) {

						}
					})
				} else {
					this.$u.route({
						url: path,
						params
					})
				}
			},
		}
	}
</script>

<style scoped lang="scss">
	page {
		background-color: red;
	}

	.con {
		padding: 0 32rpx;
	}

	.walletMain {
		padding: 30rpx 0;
		color: #fff;
		background: #4892F5;
		border-top: 1rpx solid rgba(0, 0, 0, 0.1);
		position: relative;

		.mingxi {
			padding: 0 30rpx;
			height: 60rpx;
			line-height: 60rpx;
			position: absolute;
			right: 0;
			top: 0;
		}
	}

	.tixian {
		text-align: center;
		padding-top: 30rpx;

		h3 {
			font-size: 40rpx;
			color: rgba(0, 0, 0, 0.5);
		}

		.p {
			font-size: 50rpx;
		}

		.btn {
			border: 1px solid #fff;
			width: 200rpx;
			height: 60rpx;
			line-height: 60rpx;
			border-radius: 8rpx;
			font-size: 26rpx;
			margin: 0 auto;
			margin-top: 15rpx;
		}
	}

	.walletMainList {
		display: flex;
		flex-wrap: wrap;

		.li {
			padding: 20rpx 0;
			width: 50%;
			text-align: center;
			// border-bottom: 1px solid rgba(0,0,0,0.1);
		}

		.h3 {
			font-size: 30rpx;
			color: #000;
		}

		.p {
			font-size: 26rpx;
			margin-bottom: 10rpx;
		}
	}

	.walletList {
		margin: 30rpx 0;
	}

	.walletT {
		display: flex;
		justify-content: space-between;
		align-items: center;
		font-size: 30rpx;
		height: 80rpx;
		border-bottom: 1px solid #F4F4F5;

		.l {
			font-size: 30rpx;
		}
	}

	.walletT .r {
		color: #fb5e4d;
		font-size: 28rpx;
	}



	.hr {
		height: 20rpx;
		background-color: #F4F4F5;
	}

	.walletD {
		padding: 20rpx 0;
		padding-bottom: 0;
		display: flex;
		flex-wrap: wrap;

		.li {
			width: 50%;
			margin-bottom: 20rpx;
		}

		.h3 {
			font-size: 30rpx;
			color: #b3b3b3;
			margin-bottom: 10rpx;
		}

		.p {
			font-size: 28rpx;
			color: #ea4e25;
			font-weight: bold;
		}
	}
</style>
